package com.dayuanit.atm.test.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class PayProcess {

    @Pointcut("execution(* com.dayuanit.atm.test.aop.PayServiceImpl.*(..))")
    public void pointPay() {
    }

    @Pointcut("execution(* com.dayuanit.atm.test.aop.OrderService.*(..))")
    public void pointOrder() {
    }

    @Before("pointPay()")
    public void doBefore() {
        System.out.println("pay before...");
    }

//    @After("pointOrder()")
//    public void doOrderafter() {
//        System.out.println("create order after...");
//    }

    @Around("pointOrder()")
    public void doAroundOrder(ProceedingJoinPoint pjp) {
        System.out.println("create order before ...");

//        try {
//            pjp.proceed();
//        } catch (Throwable throwable) {
//        }

        System.out.println("create order after...");
    }

}
